<%@ page import="com.situ.web.pojo.entity.Student" %>
<%@ page import="com.situ.web.pojo.entity.User" %>
<%@ page import="com.situ.web.util.PageInfo" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 4/7/2024
  Time: 4:27 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="static/bootstrap-3.4.1-dist/css/bootstrap.css">
</head>
<body>
<%
    PageInfo<User> pageInfo = (PageInfo<User>) request.getAttribute("pageInfo");
%>
<a class="btn btn-primary" href="student_add.jsp">添加</a>
<table class="table table-striped table-bordered table-hover table-condensed">
    <tr>
        <td>ID</td>
        <td>名字</td>
        <td>密码</td>
        <td>删除</td>
        <td>编辑</td>
    </tr>
    <%
        for (User user : pageInfo.getList()) {
    %>
    <tr>
        <td><%=user.getId()%></td>
        <td><%=user.getName()%></td>
        <td><%=user.getPassword()%></td>
        <td><a href="javascript:void(0)" onclick="deleteById(<%=user.getId()%>)">删除</a></td>
        <td><a href="/student?method=toUpdate&id=<%=user.getId()%>">编辑</a></td>
    </tr>
    <%
        }
    %>
</table>

<nav aria-label="Page navigation">
    <ul class="pagination">
        <li>
            <a href="#" aria-label="Previous">
                <span aria-hidden="true">&laquo;</span>
            </a>
                <%
                for (int i = 1; i <= pageInfo.getTotalPage(); i++) {
            %>
        <li><a href="/user?method=selectByPage&pageNo=<%=i%>"><%=i%></a></li>
        <%
            }
        %>
        <li>
            <a href="#" aria-label="Next">
                <span aria-hidden="true">&raquo;</span>
            </a>
        </li>
    </ul>
</nav>
</body>
</html>

